package com.luban.springcloud.service.impl;

import java.util.List;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;

import com.luban.springcloud.pojo.User;
import com.luban.springcloud.repository.UserRepository;
import com.luban.springcloud.service.UserService;

@Service
public class UserServiceImpl implements UserService{
	
	@Resource
	private UserRepository userRepository;

	public User addOrUpdateUser(User user) {
		return userRepository.save(user);
	}

	public User findUserById(Integer id) {
		return userRepository.getOne(id);
	}

	public List<User> listUser() {
		return userRepository.findAll();
	}

	public void deleteUser(Integer id) {
		userRepository.deleteById(id);
	}
}
